import { request } from "@/utils/service"
import type * as User from "./types/user"
import { getToken } from "@/utils/cache/cookies"
/** 增 */
export function createUserDataApi(data: User.ICreateUserRequestData) {
  return request({
    url: "user/add",
    method: "post",
    data
  })
}

/** 删 */
export function deleteUserDataApi(id: string) {
  return request({
    url: "user/del",
    method: "delete",
    params: {
      id
    }
  })
}

/** 改 */
export function updateUserDataApi(data: User.IUpdateUserRequestData) {
  return request({
    url: "user/update",
    method: "put",
    data
  })
}
/** 禁用 */
export function disabledUser(data: any) {
  return request({
    url: "/user/forbidden",
    method: "put",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    data
  })
}

/** 查 */
export function getUserDataApi(params: User.IGetUserRequestData) {
  return request<User.GetUserResponseData>({
    url: "user/query",
    method: "get",
    params
  })
}

// 自己修改密码和名字
export function updateUserDataApiOne(data: User.IUpdateUserRequestData) {
  return request({
    url: "user/rePassword",
    method: "put",
    data
  })
}
// 根据部门查找团队
export function getdepartement(params: any) {
  return request<any>({
    url: "department/info",
    method: "get",
    params
  })
}
// 查询全国地址
export function getmapApi(params: any) {
  return request({
    url: "/order/queryAddress",
    method: "get",
    params
  })
}

/** 增钱 */
export function addMoneyS(data: any) {
  return request({
    url: "money/add",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    data
  })
}
